<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>预测分析 - 智能制造分析系统</title>

  <!-- Google Font: Source Sans Pro -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="../../assets/css/all.min.css">
  <!-- AdminLTE -->
  <link rel="stylesheet" href="../../assets/css/adminlte.min.css">
  <!-- Select2 -->
  <link rel="stylesheet" href="../../assets/css/select2.min.css">
  <link rel="stylesheet" href="../../assets/css/select2-bootstrap4.min.css">
  <!-- DataTables -->
  <link rel="stylesheet" href="../../assets/css/dataTables.bootstrap4.min.css">
  <!-- Chart.js -->
  <link rel="stylesheet" href="../../assets/css/chart.min.css">
  <!-- daterangepicker -->
  <link rel="stylesheet" href="../../assets/css/daterangepicker.css">
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
  <!-- Navbar -->
  <nav class="main-header navbar navbar-expand navbar-white navbar-light">
    <!-- Left navbar links -->
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
      </li>
    </ul>

    <!-- Right navbar links -->
    <ul class="navbar-nav ml-auto">
      <li class="nav-item">
        <a class="nav-link" data-widget="fullscreen" href="#" role="button">
          <i class="fas fa-expand-arrows-alt"></i>
        </a>
      </li>
    </ul>
  </nav>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->
  <aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <a href="../../index.html" class="brand-link">
      <img src="../../assets/img/AdminLTELogo.png" alt="Logo" class="brand-image img-circle elevation-3" style="opacity: .8">
      <span class="brand-text font-weight-light">智能制造分析系统</span>
    </a>

    <!-- Sidebar -->
    <div class="sidebar">
      <!-- Sidebar Menu -->
      <nav class="mt-2">
        <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
          <li class="nav-item">
            <a href="../dashboard.html" class="nav-link">
              <i class="nav-icon fas fa-tachometer-alt"></i>
              <p>生产监控</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="../yield-analysis.html" class="nav-link">
              <i class="nav-icon fas fa-chart-line"></i>
              <p>良率分析</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="../equipment-maintenance.html" class="nav-link">
              <i class="nav-icon fas fa-cogs"></i>
              <p>设备维护</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="../data-source.html" class="nav-link">
              <i class="nav-icon fas fa-database"></i>
              <p>数据源配置</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="../system-settings.html" class="nav-link">
              <i class="nav-icon fas fa-cog"></i>
              <p>系统设置</p>
            </a>
          </li>
          <li class="nav-header">AI功能</li>
          <li class="nav-item">
            <a href="model-management.html" class="nav-link">
              <i class="nav-icon fas fa-brain"></i>
              <p>模型管理</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="prediction-analysis.html" class="nav-link active">
              <i class="nav-icon fas fa-chart-bar"></i>
              <p>预测分析</p>
            </a>
          </li>
        </ul>
      </nav>
      <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1>预测分析</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">首页</a></li>
              <li class="breadcrumb-item active">预测分析</li>
            </ol>
          </div>
        </div>
      </div>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <!-- 预测概览 -->
        <div class="row">
          <div class="col-lg-3 col-6">
            <div class="small-box bg-info">
              <div class="inner">
                <h3>95.8%</h3>
                <p>预测准确率</p>
              </div>
              <div class="icon">
                <i class="fas fa-bullseye"></i>
              </div>
              <a href="#" class="small-box-footer">
                更多信息 <i class="fas fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
          <div class="col-lg-3 col-6">
            <div class="small-box bg-success">
              <div class="inner">
                <h3>12</h3>
                <p>今日预测次数</p>
              </div>
              <div class="icon">
                <i class="fas fa-chart-line"></i>
              </div>
              <a href="#" class="small-box-footer">
                更多信息 <i class="fas fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
          <div class="col-lg-3 col-6">
            <div class="small-box bg-warning">
              <div class="inner">
                <h3>3</h3>
                <p>预警信息</p>
              </div>
              <div class="icon">
                <i class="fas fa-exclamation-triangle"></i>
              </div>
              <a href="#" class="small-box-footer">
                查看详情 <i class="fas fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
          <div class="col-lg-3 col-6">
            <div class="small-box bg-danger">
              <div class="inner">
                <h3>1</h3>
                <p>异常预测</p>
              </div>
              <div class="icon">
                <i class="fas fa-times-circle"></i>
              </div>
              <a href="#" class="small-box-footer">
                查看详情 <i class="fas fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
        </div>

        <!-- 预测配置 -->
        <div class="row">
          <div class="col-md-12">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">预测配置</h3>
              </div>
              <div class="card-body">
                <form>
                  <div class="row">
                    <div class="col-md-3">
                      <div class="form-group">
                        <label>预测类型</label>
                        <select class="form-control select2" style="width: 100%;">
                          <option>良率预测</option>
                          <option>设备故障预测</option>
                          <option>生产异常预测</option>
                        </select>
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label>时间范围</label>
                        <div class="input-group">
                          <div class="input-group-prepend">
                            <span class="input-group-text">
                              <i class="far fa-calendar-alt"></i>
                            </span>
                          </div>
                          <input type="text" class="form-control float-right" id="reservation">
                        </div>
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label>生产线</label>
                        <select class="form-control select2" style="width: 100%;">
                          <option>全部</option>
                          <option>生产线1</option>
                          <option>生产线2</option>
                          <option>生产线3</option>
                        </select>
                      </div>
                    </div>
                    <div class="col-md-3">
                      <div class="form-group">
                        <label>&nbsp;</label>
                        <button type="button" class="btn btn-primary btn-block">开始预测</button>
                      </div>
                    </div>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>

        <!-- 预测结果 -->
        <div class="row">
          <div class="col-md-8">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">预测趋势</h3>
              </div>
              <div class="card-body">
                <canvas id="predictionChart" style="min-height: 300px; height: 300px; max-height: 300px; max-width: 100%;"></canvas>
              </div>
            </div>
          </div>
          <div class="col-md-4">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">预测分布</h3>
              </div>
              <div class="card-body">
                <canvas id="distributionChart" style="min-height: 300px; height: 300px; max-height: 300px; max-width: 100%;"></canvas>
              </div>
            </div>
          </div>
        </div>

        <!-- 预警信息 -->
        <div class="row">
          <div class="col-md-12">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">预警信息</h3>
              </div>
              <div class="card-body">
                <div class="alert alert-warning alert-dismissible">
                  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                  <h5><i class="icon fas fa-exclamation-triangle"></i> 预警!</h5>
                  生产线1的良率预测值低于目标值，建议及时检查生产参数。
                </div>
                <div class="alert alert-danger alert-dismissible">
                  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                  <h5><i class="icon fas fa-ban"></i> 异常!</h5>
                  设备A的故障预测概率超过阈值，请安排维护检查。
                </div>
              </div>
            </div>
          </div>
        </div>

        <!-- 历史记录 -->
        <div class="row">
          <div class="col-md-12">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">预测历史记录</h3>
              </div>
              <div class="card-body">
                <table id="predictionTable" class="table table-bordered table-striped">
                  <thead>
                    <tr>
                      <th>预测时间</th>
                      <th>预测类型</th>
                      <th>预测对象</th>
                      <th>预测结果</th>
                      <th>实际结果</th>
                      <th>准确率</th>
                      <th>状态</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>2024-02-20 10:00</td>
                      <td>良率预测</td>
                      <td>生产线1</td>
                      <td>95.8%</td>
                      <td>96.2%</td>
                      <td>99.6%</td>
                      <td><span class="badge badge-success">准确</span></td>
                    </tr>
                    <tr>
                      <td>2024-02-20 09:30</td>
                      <td>设备故障预测</td>
                      <td>设备A</td>
                      <td>故障概率: 85%</td>
                      <td>发生故障</td>
                      <td>95%</td>
                      <td><span class="badge badge-success">准确</span></td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>

  <!-- Main Footer -->
  <footer class="main-footer">
    <div class="float-right d-none d-sm-block">
      <b>Version</b> 1.0.0
    </div>
    <strong>Copyright &copy; 2024 <a href="#">智能制造分析系统</a>.</strong> All rights reserved.
  </footer>
</div>

<!-- jQuery -->
<script src="../../assets/js/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../../assets/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="../../assets/js/adminlte.min.js"></script>
<!-- Select2 -->
<script src="../../assets/js/select2.min.js"></script>
<!-- DataTables -->
<script src="../../assets/js/jquery.dataTables.min.js"></script>
<script src="../../assets/js/dataTables.bootstrap4.min.js"></script>
<!-- Chart.js -->
<script src="../../assets/js/chart.min.js"></script>
<!-- daterangepicker -->
<script src="../../assets/js/daterangepicker.min.js"></script>

<script>
$(function () {
  // 初始化Select2
  $('.select2').select2({
    theme: 'bootstrap4'
  });

  // 初始化DataTable
  $('#predictionTable').DataTable({
    "paging": true,
    "lengthChange": true,
    "searching": true,
    "ordering": true,
    "info": true,
    "autoWidth": false,
    "responsive": true,
  });

  // 初始化日期范围选择器
  $('#reservation').daterangepicker({
    startDate: moment().subtract(7, 'days'),
    endDate: moment(),
    locale: {
      format: 'YYYY-MM-DD'
    }
  });

  // 初始化预测趋势图
  var predictionCtx = document.getElementById('predictionChart').getContext('2d');
  var predictionChart = new Chart(predictionCtx, {
    type: 'line',
    data: {
      labels: ['1月', '2月', '3月', '4月', '5月', '6月'],
      datasets: [{
        label: '预测值',
        data: [92, 93, 94, 95, 95.5, 95.8],
        borderColor: 'rgb(75, 192, 192)',
        tension: 0.1
      }, {
        label: '实际值',
        data: [92.5, 93.2, 94.1, 95.3, 95.7, 96.2],
        borderColor: 'rgb(255, 99, 132)',
        tension: 0.1
      }]
    },
    options: {
      responsive: true,
      maintainAspectRatio: false,
      scales: {
        y: {
          beginAtZero: false,
          min: 90,
          max: 100
        }
      }
    }
  });

  // 初始化预测分布图
  var distributionCtx = document.getElementById('distributionChart').getContext('2d');
  var distributionChart = new Chart(distributionCtx, {
    type: 'doughnut',
    data: {
      labels: ['准确', '基本准确', '不准确'],
      datasets: [{
        data: [70, 20, 10],
        backgroundColor: [
          'rgb(75, 192, 192)',
          'rgb(255, 205, 86)',
          'rgb(255, 99, 132)'
        ]
      }]
    },
    options: {
      responsive: true,
      maintainAspectRatio: false
    }
  });
});
</script>
</body>
</html> 